package www.my.imageframecompare.drawableUtil;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import www.my.imageframecompare.R;
/**
 * http://blog.csdn.net/lmj623565791/article/details/43752383
 */

public class DrawableShowActivity extends AppCompatActivity {
    private static final String TAG = "DrawableShowActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_drawable_show);
        ImageView iv0= (ImageView) findViewById(R.id.imageView0);
        ImageView iv1= (ImageView) findViewById(R.id.imageView1);
        TextView tv= (TextView) findViewById(R.id.textView);
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_man);
        RoundImageDrawable roundImageDrawable = new RoundImageDrawable(bitmap, 100);
        RoundImageDrawable roundImageDrawable1 = new RoundImageDrawable(bitmap);
        CircleImageDrawable circleImageDrawable = new CircleImageDrawable(bitmap);

        iv0.setImageDrawable(circleImageDrawable);
        iv1.setImageDrawable(circleImageDrawable);
        tv.setBackground(roundImageDrawable);

        final MessageListItem ll = (MessageListItem) findViewById(R.id.ll);
        final MessageListItem ll2 = (MessageListItem) findViewById(R.id.ll2);
        ll.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i(TAG, "onClick: 11==="+ ll.getStateMessageReaded());
            }
        });
        ll2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Log.i(TAG, "onClick: 22==="+ ll2.getStateMessageReaded());
            }
        });
    }
}
